Skip database views during search-replace#215
Merged
swissspidy merged 5 commits intomainfrom Mar 16, 2026
Merged
Conversation
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] [ISSUE-145] Skip views in search-replace process
Skip database views during search-replace
Mar 15, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the search-replace command to avoid processing MySQL/MariaDB views, which can’t be directly modified and may trigger ERROR 1449 when accessed on a different server.
Changes:
- Detects views by running a second
wp_get_table_names()query withviews-only: true. - Skips views during iteration (including export mode) and records them in the report as
skipped (view)(unless--report-changed-onlyis enabled). - Adds a Behat scenario to assert views are skipped under both
--all-tables-with-prefixand--all-tables.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/Search_Replace_Command.php | Detect views and skip them during processing / export, optionally reporting skipped (view). |
| features/search-replace.feature | Adds an integration scenario that creates a view and verifies it is reported as skipped. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Database views cannot be directly modified and may trigger
ERROR 1449(definer user doesn't exist) when accessed on a different server. Thesearch-replacecommand should skip them rather than attempting replacements.Changes
wp_get_table_names()call withviews-only: true(using the same scope flags) to identify views in the working setskipped (view)entry is added to the report unless--report-changed-onlyis activeExample output
skipped (view)under both--all-tables-with-prefixand--all-tablesOriginal prompt
📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.